import { isArray  } from './dataType'
export function deleteVoidAttr(target: any, withoutDelete?: string[]) {
  const withoutDelete_ = withoutDelete || []
  return Object.keys(target).reduce((result,key)=>{
    const value = target[key]
    const valid = !isArray(value) && ![null,undefined,''].includes(value)
    const validArr = isArray(value) && value.length
    if(valid || validArr || withoutDelete_.includes(key)) {
      result[key] = value
    }
    return result
  },{} as any)
}
